package yang.yu.sunny.domain.product;

import yang.yu.sunny.domain.NamedEntity;

import java.util.Objects;

/**
 * 产品类别
 * Created by yyang on 16/3/15.
 */
public class ProductCategory extends NamedEntity {

    protected ProductCategory() {
    }

    public ProductCategory(String name) {
        super.setName(name);
    }

    @Override
    public int hashCode() {
        return Objects.hash(getId());
    }

    @Override
    public boolean equals(Object other) {
        if (this == other) {
            return true;
        }
        if (!(other instanceof ProductCategory)) {
            return false;
        }
        ProductCategory that = (ProductCategory) other;
        return Objects.equals(this.getId(), that.getId());
    }

    @Override
    public String toString() {
        return getName();
    }
}
